package org.systm.adminuser.service.condition;

import lombok.Getter;
import org.springframework.data.jpa.domain.Specification;
import org.systm.adminuser.entity.AdminUser;

import javax.persistence.criteria.Expression;
import java.util.function.Function;

public class AdminUserQuery {
    @Getter
    public static Function<String, Specification<AdminUser>> existsUsername = (username) -> (r, q, cb) -> {
        Expression<String> expr = r.get("username").as(String.class);
        return cb.equal(expr, username);
    };
}
